package common.db.test.processor;

import common.db.RowProcessor;
import common.db.DBUtilis;

import java.sql.SQLException;
import java.sql.ResultSet;
import common.db.test.entity.Proba;
import common.db.handlers.OneRowHandler;
import common.db.handlers.ListHandler;

/**
 * Created by IntelliJ IDEA.
 * User: Paskal
 * Date: Apr 6, 2009
 * Time: 12:06:56 AM
 * To change this template use File | Settings | File Templates.
 */
public class ProbaRowProcessor implements RowProcessor
{
    private final static ListHandler<Proba> LIST_HANDLER = ListHandler.getInstance(new ProbaRowProcessor());
    private final static OneRowHandler<Proba> ONE_ROW_HANDLER = OneRowHandler.getInstance(new ProbaRowProcessor());


    public static ListHandler<Proba> getListHandler()
	{
        return LIST_HANDLER;
    }

    public static OneRowHandler<Proba> getOneRowHandler()
	{
        return ONE_ROW_HANDLER;
    }


    public ProbaRowProcessor()
	{

    }

    public Proba processRow(ResultSet rs) throws SQLException
	{
        return new Proba(
                rs.getInt("id"),
			    rs.getString("name"),
                DBUtilis.getInteger(rs, "number")
        );
    }
}
